package com.shoulei.designpattern.adapterPattern;

/**
 * @ClassName:AudioPlayer
 * @Descrition:
 * @Author:shoulei
 * @Date:2019/3/31 21:40
 * @Verson:
 */
public class AudioPlayer implements MediaPlayer{
    MediaAdapter mediaAdapter;
    @Override
    public void play(String audioType, String fileName) {
        if ("mp3".equalsIgnoreCase(audioType)){
            System.out.println("playing mp3 file. name:" + fileName);
        }else if("vlc".equalsIgnoreCase(audioType) || "mp4".equalsIgnoreCase(audioType)){
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType,fileName);
        }else {
            System.out.println("Invald media. "+ audioType + "format not support");
        }
    }
}
